﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Employee.master" AutoEventWireup="true"
    CodeFile="EditStock.aspx.cs" Inherits="Pages_Employee_Manage_Stocks_EditStock" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table width="100%">
        <tr>
            <td valign="middle" class="header">
                Edit a deliverable information in stock
            </td>
        </tr>
    </table>
    <br />
    <br />
    <asp:FormView ID="frmViewEditStock" runat="server" Width="500px" BackColor="#DEBA84"
        BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2"
        GridLines="Both" DataSourceID="ObjectDataSourceEditStock" OnItemCommand="FormViewEditStock_ItemCommand">
        <ItemTemplate>
            <div>
                <table class="table01" width="100%">
                    <tr>
                        <td width="20%">
                            &nbsp;
                        </td>
                        <td width="40%">
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td width="20%">
                            <b>
                                <asp:Label ID="lblDeliveryNumber" runat="server" Text="Deliverable ID"></asp:Label></b>
                        </td>
                        <td width="40%">
                            <asp:TextBox ID="txtDeliveryNumber" runat="server" Enabled="False" onkeypress="return onlyNumbers();"
                                Text='<%# Bind("DeliverableID") %>'></asp:TextBox>
                    </tr>
                    <tr>
                        <td width="20%">
                            <b>
                                <asp:Label ID="lblFromStock" runat="server" Text="From Stock"></asp:Label></b>
                        </td>
                        <td width="40%">
                            <asp:DropDownList ID="ddlFromStock" runat="server" DataSourceID="ObjectDataSourceFromStock"
                                DataTextField="BranchName" DataValueField="PinCode" SelectedValue='<%# Bind("FromStock") %>'
                                Enabled="False">
                            </asp:DropDownList>
                            <asp:ObjectDataSource ID="ObjectDataSourceFromStock" runat="server" OldValuesParameterFormatString="original_{0}"
                                SelectMethod="ListStock" TypeName="DALStock"></asp:ObjectDataSource>
                        </td>
                    </tr>
                    <tr>
                        <td width="20%">
                            <b>
                                <asp:Label ID="lblToStock" runat="server" Text="To Stock"></asp:Label></b>
                        </td>
                        <td width="40%">
                            <asp:DropDownList ID="ddlToStock" runat="server" DataSourceID="ObjectDataSourceToStock"
                                DataTextField="BranchName" DataValueField="PinCode" Enabled="false" SelectedValue='<%# Bind("ToStock") %>'>
                            </asp:DropDownList>
                            <asp:ObjectDataSource ID="ObjectDataSourceToStock" runat="server" OldValuesParameterFormatString="original_{0}"
                                SelectMethod="ListStock" TypeName="DALStock"></asp:ObjectDataSource>
                        </td>
                    </tr>
                    <tr>
                        <td width="20%">
                            <b>
                                <asp:Label ID="lblReceivedDate" runat="server" Text="Received Date"></asp:Label></b>
                        </td>
                        <td width="40%">
                            <asp:TextBox runat="server" ID="txtReceivedDate" autocomplete="off" Text='<%# Bind("ReceivedDate") %>'
                                Enabled="false" />
                        </td>
                    </tr>
                    <tr>
                        <td width="20%">
                            <b>
                                <asp:Label ID="lblSentDate" runat="server" Text="Send Date"></asp:Label></b>
                        </td>
                        <td width="40%">
                            <asp:TextBox runat="server" ID="txtSentDate" autocomplete="off" Text='<%# Bind("SentDate") %>'
                                Enabled="false" />
                        </td>
                    </tr>
                    <tr>
                        <td width="20%">
                            <b>
                                <asp:Label ID="lblDelivery" runat="server" Text="Delivery To Customer"></asp:Label></b>
                        </td>
                        <td width="40%">
                            <asp:CheckBox ID="ckbStatus" runat="server" Checked='<%# Bind("Status") %>' Enabled="false" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" width="20%">
                            <asp:Button ID="cmdEdit" runat="server" Text="Edit" CommandName="Edit" Width="150" />
                        </td>
                    </tr>
                </table>
            </div>
        </ItemTemplate>
        <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
        <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
        <EditItemTemplate>
            <div>
                <%--   <asp:UpdatePanel ID="udpAddStock" runat="server">
            <ContentTemplate>--%>
                <table class="table01" width="100%">
                    <tr>
                        <td width="20%">
                            &nbsp;
                        </td>
                        <td width="40%">
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td width="20%">
                            <b>
                                <asp:Label ID="lblDeliveryNumber" runat="server" Text="Deliverable ID"></asp:Label></b>
                        </td>
                        <td width="40%">
                            <%-- <asp:UpdatePanel runat="server" ID="udpDeliveryNumber">
            <ContentTemplate>--%>
                            <asp:TextBox ID="txtDeliveryNumber" runat="server" 
                                onkeypress="return onlyNumbers();" Text='<%# Bind("DeliverableID") %>' 
                                Enabled="False"></asp:TextBox>
                            <%--   </ContentTemplate>
        </asp:UpdatePanel>--%>
                            
                            <asp:RequiredFieldValidator ID="valDeliveryNumber" runat="server" 
                                ControlToValidate="txtDeliveryNumber" 
                                ErrorMessage="Delivery number cannot be blank" Text="*" 
                                ValidationGroup="AddStock"></asp:RequiredFieldValidator>
                            
                            <asp:RegularExpressionValidator ID="valDeliverableID" runat="server" 
                                ControlToValidate="txtDeliveryNumber" ValidationGroup="AddStock"
                                ErrorMessage="Deliverable ID is not valid" ValidationExpression="\d+">*</asp:RegularExpressionValidator>
                            
                        </td>
                    </tr>
                    <tr>
                        <td width="20%">
                            <b>
                                <asp:Label ID="lblFromStock" runat="server" Text="From Stock"></asp:Label></b>
                        </td>
                        <td width="40%">
                            <asp:DropDownList ID="ddlFromStock" runat="server" DataSourceID="ObjectDataSourceFromStock"
                                DataTextField="BranchName" DataValueField="PinCode" 
                                ValidationGroup="AddStock" SelectedValue='<%# Bind("FromStock") %>'>
                            </asp:DropDownList>
                            <asp:ObjectDataSource ID="ObjectDataSourceFromStock" runat="server" OldValuesParameterFormatString="original_{0}"
                                SelectMethod="ListStock" TypeName="DALStock"></asp:ObjectDataSource>
                        </td>
                    </tr>
                    <tr>
                        <td width="20%">
                            <b>
                                <asp:Label ID="lblToStock" runat="server" Text="To Stock"></asp:Label></b>
                        </td>
                        <td width="40%">
                            <asp:DropDownList ID="ddlToStock" runat="server" DataSourceID="ObjectDataSourceToStock"
                                DataTextField="BranchName" DataValueField="PinCode" 
                                ValidationGroup="AddStock" SelectedValue='<%# Bind("ToStock") %>'>
                            </asp:DropDownList>
                            <asp:ObjectDataSource ID="ObjectDataSourceToStock" runat="server" OldValuesParameterFormatString="original_{0}"
                                SelectMethod="ListStock" TypeName="DALStock"></asp:ObjectDataSource>
                        </td>
                    </tr>
                    <tr>
                        <td width="20%">
                            <b>
                                <asp:Label ID="lblReceivedDate" runat="server" Text="Received Date"></asp:Label></b>
                        </td>
                        <td width="40%">
                            <asp:TextBox runat="server" ID="txtReceivedDate" autocomplete="off" 
                                ValidationGroup="AddStock" Text='<%# Bind("ReceivedDate") %>' />
                            <%--  <ajaxToolkit:CalendarExtender ID="CalendarExtenderReceived" runat="server" TargetControlID="txtReceivedDate"
                                CssClass="MyCalendar" Format="yyyy-MM-dd" PopupPosition="BottomRight" />--%>
                            <asp:RequiredFieldValidator ID="valBirthDate" runat="server" ControlToValidate="txtReceivedDate"
                                ValidationGroup="AddStock" ErrorMessage="Received Date cannot be blank"
                                Text="*"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionReceivedDate" runat="server"
                                ErrorMessage="Received Date is not valid" ControlToValidate="txtReceivedDate"
                                ValidationGroup="AddStock" 
                                ValidationExpression="(?n:^(?=\d)((?<day>31(?!(.0?[2469]|11))|30(?!.0?2)|29(?(.0?2)(?=.{3,4}(1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|(16|[2468][048]|[3579][26])00))|0?[1-9]|1\d|2[0-8])(?<sep>[/.-])(?<month>0?[1-9]|1[012])\2(?<year>(1[6-9]|[2-9]\d)\d{2})(?:(?=\x20\d)\x20|$))?(?<time>((0?[1-9]|1[012])(:[0-5]\d){0,2}(?i:\ [AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$)">*</asp:RegularExpressionValidator>
                        </td>
                    </tr>
                    <tr>
                        <td width="20%">
                            <b>
                                <asp:Label ID="lblSentDate" runat="server" Text="Send Date"></asp:Label></b>
                        </td>
                        <td width="40%">
                            <asp:TextBox runat="server" ID="txtSentDate" autocomplete="off" 
                                ValidationGroup="AddStock" Text='<%# Bind("SentDate") %>' />
                            <%-- <ajaxToolkit:CalendarExtender ID="CalendarExtenderSend" runat="server" TargetControlID="txtSentDate"
                                CssClass="MyCalendar" Format="yyyy-MM-dd" PopupPosition="BottomRight" />--%>
                              <asp:RegularExpressionValidator ID="RegularExpressionSentDate" runat="server"
                                ErrorMessage="Received Date is not valid" ControlToValidate="txtSentDate"
                                ValidationGroup="AddStock" 
                                ValidationExpression="(?n:^(?=\d)((?<day>31(?!(.0?[2469]|11))|30(?!.0?2)|29(?(.0?2)(?=.{3,4}(1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|(16|[2468][048]|[3579][26])00))|0?[1-9]|1\d|2[0-8])(?<sep>[/.-])(?<month>0?[1-9]|1[012])\2(?<year>(1[6-9]|[2-9]\d)\d{2})(?:(?=\x20\d)\x20|$))?(?<time>((0?[1-9]|1[012])(:[0-5]\d){0,2}(?i:\ [AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$)">*</asp:RegularExpressionValidator>
                        </td>
                    </tr>
                    <tr>
                        <td width="20%">
                            <b>
                                <asp:Label ID="lblDelivery" runat="server" Text="Deliveried To Customer"></asp:Label></b>
                        </td>
                        <td width="40%">
                            <asp:CheckBox ID="ckbStatus" runat="server" ValidationGroup="AddStock" 
                                Checked='<%# Bind("Status") %>' />
                            <%--  <asp:UpdateProgress ID="UpdateProgress1" runat="server">
                                <ProgressTemplate>
                                    <img alt="" src="../../Images/indicator.gif" style="width: 16px; height: 16px" />loadding
                                </ProgressTemplate>
                            </asp:UpdateProgress>--%>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <asp:Button ID="cmdCancel" runat="server" Text="Cancel" CausesValidation="false"
                                ValidationGroup="AddStock" CommandName="Cancel" />
                            <asp:Button ID="cmdUpdate" runat="server" Text="Update" ValidationGroup="AddStock"
                                CommandName="Submit" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="AddStock" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <asp:Label ID="lblMessage" runat="server" Font-Italic="True" Font-Bold="True" ForeColor="Red"></asp:Label>
                        </td>
                    </tr>
                </table>
                <%--    </ContentTemplate>
        </asp:UpdatePanel>--%>
            </div>
        </EditItemTemplate>
        <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
        <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
        <EditRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
    </asp:FormView>
    <asp:ObjectDataSource ID="ObjectDataSourceEditStock" runat="server" 
        OldValuesParameterFormatString="original_{0}" 
        SelectMethod="SelectedDeliverableInStock" TypeName="DALStock">
        <SelectParameters>
            <asp:QueryStringParameter Name="DeliverableID" QueryStringField="DeliverableID" 
                Type="String" />
            <asp:SessionParameter Name="StockPinCode" SessionField="PinCode" 
                Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:Label ID="lblMessage" runat="server" Font-Italic="True" Font-Bold="True" 
        ForeColor="Red"></asp:Label>
</asp:Content>
